<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads"
    xmlns:rim="http://www.blackberry.com/ns/widgets"
    id="phonegap-plugin-push"
    version="1.5.2">

  <name>PushPlugin</name>
	<author>Bob Easterday</author>

	<description>
		This plugin allows your application to receive push notifications on Android, iOS, WP8 and Windows8 devices.
    Android uses Google Cloud Messaging.
    iOS uses Apple APNS Notifications.
    WP8 uses Microsoft MPNS Notifications.
    Windows8 uses Microsoft WNS Notifications.
	</description>

	<license>MIT</license>

	<js-module src="www/push.js" name="PushNotification">
        <clobbers target="PushNotification" />
	</js-module>

	<engines>
        <engine name="cordova" version=">=3.6.3" />
        <engine name="cordova-android" version=">=4.0.0" />
    </engines>

	<!-- android -->
	<platform name="android">

		<config-file target="res/xml/config.xml" parent="/*">
			<feature name="PushNotification" >
				<param name="android-package" value="com.adobe.phonegap.push.PushPlugin"/>
			</feature>
		</config-file>

		<config-file target="AndroidManifest.xml" parent="/manifest">
            <uses-permission android:name="android.permission.INTERNET" />
			<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
			<uses-permission android:name="android.permission.WAKE_LOCK" />
			<uses-permission android:name="android.permission.VIBRATE"/>
			<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
			<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
			<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
		</config-file>

		<config-file target="AndroidManifest.xml" parent="/manifest/application">
			<activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true"/>

            <receiver
                android:name="com.google.android.gms.gcm.GcmReceiver"
                android:exported="true"
                android:permission="com.google.android.c2dm.permission.SEND" >
                <intent-filter>
                    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                    <category android:name="${applicationId}" />
                </intent-filter>
            </receiver>
            <service
                android:name="com.adobe.phonegap.push.GCMIntentService"
                android:exported="false" >
                <intent-filter>
                    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                </intent-filter>
            </service>
            <service
                android:name="com.adobe.phonegap.push.PushInstanceIDListenerService"
                android:exported="false">
                <intent-filter>
                    <action android:name="com.google.android.gms.iid.InstanceID"/>
                </intent-filter>
            </service>
            <service
                android:name="com.adobe.phonegap.push.RegistrationIntentService"
                android:exported="false">
            </service>
		</config-file>

        <framework src="push.gradle" custom="true" type="gradleReference" />
        <framework src="com.android.support:support-v13:23+" />
        <framework src="com.google.android.gms:play-services-gcm:+" />

		<source-file src="src/android/com/adobe/phonegap/push/GCMIntentService.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/adobe/phonegap/push/PushConstants.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/adobe/phonegap/push/PushHandlerActivity.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/adobe/phonegap/push/PushPlugin.java" target-dir="src/com/adobe/phonegap/push/" />
        <source-file src="src/android/com/adobe/phonegap/push/RegistrationIntentService.java" target-dir="src/com/adobe/phonegap/push/" />
        <source-file src="src/android/com/adobe/phonegap/push/PermissionUtils.java" target-dir="src/com/adobe/phonegap/push/" />

	</platform>

	<!-- ios -->
	<platform name="ios">

		<config-file target="config.xml" parent="/*">
			<feature name="PushNotification">
				<param name="ios-package" value="PushPlugin"/>
			</feature>
		</config-file>

        <config-file target="*-Info.plist" parent="UIBackgroundModes">
            <array>
                <string>remote-notification</string>
            </array>
        </config-file>

		<source-file src="src/ios/AppDelegate+notification.m" />
		<source-file src="src/ios/PushPlugin.m" />

		<header-file src="src/ios/AppDelegate+notification.h" />
		<header-file src="src/ios/PushPlugin.h" />

                <!--  GCM Provided Frameworks Used -->
                <framework src="AddressBook.framework" />
                <!-- Note these 2 appear in red in app code project but work-->
                <framework src="libsqlite3.tbd" />
                <framework src="libz.tbd" />

                <!--  GCM Code from Cocoapods  -->
		<header-file target-dir="GCM/Headers" src="src/ios/GGLInstanceID/Headers/Public/GGLInstanceID.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GGLInstanceID/Headers/Public/GGLInstanceIDConfig.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GGLInstanceID/Headers/Public/GGLInstanceIDDelegate.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GGLInstanceID/Headers/Public/GGLInstanceIDHeaders.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/Google/Headers/GGLCloudMessaging/Public/CloudMessaging.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/Google/Headers/GGLCloudMessaging/Public/GGLContext+CloudMessaging.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/Google/Headers/GGLCore/Public/Core.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/Google/Headers/GGLCore/Public/GGLConfiguration.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/Google/Headers/GGLCore/Public/GGLContext.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/Google/Headers/GGLCore/Public/GGLErrorCode.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GoogleCloudMessaging/Headers/Public/GCMConfig.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GoogleCloudMessaging/Headers/Public/GCMPubSub.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GoogleCloudMessaging/Headers/Public/GCMReceiverDelegate.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GoogleCloudMessaging/Headers/Public/GCMService.h" />
		<header-file target-dir="GCM/Headers" src="src/ios/GoogleCloudMessaging/Headers/Public/GoogleCloudMessaging.h" />

                <source-file target-dir="GCM/Libraries" src="src/ios/Google/Libraries/libGGLCloudMessaging.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/Google/Libraries/libGGLCore.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GGLInstanceID/Libraries/libGGLInstanceIDLib.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleIPhoneUtilities/Libraries/libGIP_Reachability.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleSymbolUtilities/Libraries/libGSDK_Overload.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleNetworkingUtilities/Libraries/libGTMSessionFetcher_core.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleNetworkingUtilities/Libraries/libGTMSessionFetcher_full.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTMStackTrace.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_AddressBook.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_DebugUtils.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_GTMURLBuilder.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_KVO.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_NSData+zlib.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_NSDictionary+URLArguments.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_NSScannerJSON.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_NSStringHTML.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_NSStringXML.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_Regex.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_RoundedRectPath.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_StringEncoding.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_SystemVersion.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_UIFont+LineHeight.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_core.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleUtilities/Libraries/libGTM_iPhone.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleCloudMessaging/Libraries/libGcmLib.a" framework="true" />
                <source-file target-dir="GCM/Libraries" src="src/ios/GoogleInterchangeUtilities/Libraries/libProtocolBuffers.a" framework="true" />
                <!--  End GCM Related Files -->
	</platform>

  	<!-- windows -->
  	<platform name="windows">
    	<js-module src="src/windows/PushPluginProxy.js" name="PushPlugin">
    		<merges target="" />
    	</js-module>
    	<config-file target="config.xml" parent="/*">
    		<preference name="WindowsToastCapable" value="true" />
    	</config-file>
	</platform>

</plugin>
